#include "junix.h"

//from ip struct
struct A 
{
	unsigned int ip_v:4;		/* version */
	unsigned int ip_hl:4;		/* header length */
	char i:4;
	char j:4;
} __attribute__ ((packed)) ;

struct ip
{
	unsigned int ip_v:4;		/* version */
	unsigned int ip_hl:4;		/* header length */
	u_int8_t ip_tos;			/* type of service */
	u_short ip_len;			/* total length */
	u_short ip_id;			/* identification */
	u_short ip_off;			/* fragment offset field */
#define	IP_RF 0x8000			/* reserved fragment flag */
#define	IP_DF 0x4000			/* dont fragment flag */
#define	IP_MF 0x2000			/* more fragments flag */
#define	IP_OFFMASK 0x1fff		/* mask for fragmenting bits */
	u_int8_t ip_ttl;			/* time to live */
	u_int8_t ip_p;			/* protocol */
	u_short ip_sum;			/* checksum */
	struct in_addr ip_src, ip_dst;	/* source and dest address */
};

int main(int argc, char **argv)
{
	printf("%d\n",sizeof(struct A));
	struct A a={0x01,0x02};
	printf("A.i:%d\nA.j:%d\n", a.i, a.j);

	printf("IP size:%d\n",sizeof(struct ip));
	struct ip;

    exit(0);
}

